<?php
class templateParser {

    // member definition
	public static $TEMPLATES = "templates";
 
	
    var $output;


	function __construct($templateFile='default.php') {
		$path=site_path.self::$TEMPLATES.DIRSEP;
		 if(file_exists($path.$templateFile)){
		 	ob_start();
	    	require_once($path.$templateFile);
	   		$content=ob_get_contents();
	    	ob_end_clean();
			$this->output=$content;
		 }
	}

 

    function parseTemplate($tags=array()){
 		if(count($tags)>0){
			foreach($tags as $tag=>$data){
				$this->output=str_replace('{'.$tag.'}',$data,$this->output);
		    }
		}
		else {
			die('Error: No tags were provided for replacement');
		}

	}


    function display(){
    	return $this->output;
    }

}
?> 
